home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / to.prg < prev    next >
Text File  |  1995-03-23  |  4KB  |  132 lines

  1. Article 1752 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!helios!tamuts!n233dk
  3. From: n233dk@tamuts.tamu.edu (Rick Grevelle)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: ->PRG & PRG-> RPL Versions
  6. Message-ID: <8979@helios.TAMU.EDU>
  7. Date: 11 Oct 90 04:22:28 GMT
  8. References: <9010102226.AA14984@CS.ORST.EDU> <34739@cup.portal.com>
  9. Sender: usenet@helios.TAMU.EDU
  10. Organization: Texas A&M University
  11. Lines: 117
  12.  
  13.  
  14. In article <3464@mindlink.UUCP> a634@mindlink.UUCP (Rob Prior) writes:
  15. >I remember there being a couple of programs for my 28s called PRG-> and ->PRG.
  16. >They functioned as follows:
  17. >
  18. >on the stack:
  19. >
  20. >4:
  21. >3:
  22. >2:
  23. >1:     << RCL DUP PURGE >>          (or whatever)
  24. >
  25. >PRG-> executed would give:
  26. >
  27. >6:                    <<
  28. >5:                   RCL
  29. >4:                   DUP
  30. >3:                 PURGE
  31. >2:                    >>
  32. >1:                     5            (this all being accomplished
  33. >                                     through the use of sysevals)
  34. >
  35. >->PRG would take the stack in part 2 and give you what you started with.  After
  36. >all, we can get all of the symbols (<<, >>, RCL, etc.) onto the stack with
  37. >sysevals.  Is there a way to implement the same programs on the 48sx?  If
  38. >someone could post their solution, it would be muchly appreciated.
  39. >
  40. >Thanks in advance,
  41. >Rob
  42.  
  43.  
  44. With all of the machine patching routines that have been posted, I incorrectly
  45. assumed everyone already knew what it was I was doing.  Thanks for asking the
  46. question; eventhough there are apparently those who have yet to see the value
  47. of such a command, I'm quite sure there are others who would like to have this
  48. highly convenient tool at their disposal.  Why HP left this command out of the
  49. OBJ-> command is a mystery to me. 
  50.  
  51.  
  52.  
  53. 054AF   list->, algebraic->, program->
  54. 05445   ->program
  55. 05459   ->list
  56. 0546D   ->algebraic
  57.  
  58.  
  59. These SYSEVALs do no argument checking and could be potentially dangerous if
  60. misused.  To alleviate this I've included two short routines which will create
  61. versions of ->PRG and PRG-> that will do the necessary argument checking.  For
  62. the reason that these routines are of a relatively short size of, I see no need
  63. for posting an encoded version.  RPL disassemblies are included for clarity.
  64.  
  65.  
  66.  
  67. CPRG-> 
  68. (BYTES: #46D6h 82.5) 
  69.  
  70. %%HP: T(3)A(D)F(.);
  71. \<<
  72.  # F18FB218AB202D9Dh
  73.  # 312B1C9730403h
  74.  # 5193h SYSEVAL
  75.  # 4003h SYSEVAL
  76.  # 62B9Ch SYSEVAL
  77. \>>
  78.  
  79.  
  80. PRG-> 
  81.  
  82. 02D9D    begin RPL
  83. 18AB2   need one argument from stack
  84. 18FB2    check one argument for type
  85. 0403F   short integer <8h>, program
  86. 1C973   program->
  87. 0312B   end
  88.  
  89.  
  90.  
  91. C->PRG
  92. (BYTES: #D79h 82.5)  
  93.  
  94. %%HP: T(3)A(D)F(.);
  95. \<<
  96.  # B0544518C3402D9Dh
  97.  # 312h # 5193h
  98.  SYSEVAL # 4003h
  99.  SYSEVAL 62B9Ch
  100.  SYSEVAL
  101. \>>
  102.  
  103.  
  104. ->PRG
  105.  
  106. 02D9D   begin RPL
  107. 18C34    need n arguments from stack
  108. 05445   ->program
  109. 0312B   end
  110.  
  111.  
  112. For PRG-> I prefer to use the two prefixed machine routines # 18AB2h and 
  113. # 18FB2h, rather than # 18ECEh, for the reason they don't give all of the
  114. added garbage in the error message.  The only disadvantage is it takes
  115. two of them to do what # 18ECEh does alone.
  116.  
  117. As for as the ->PRG routine is concerned, I've yet to find a more suitable
  118. address for checking in this situation.  The error message it returns will
  119. contain the extraneous information "XLIB 25 45" before the actual message.
  120.  
  121. One final note; both routines here will be created without their user program
  122. delimiters.  If for some reason this is annoys you, ->PRG and PRG-> can be 
  123. used to to install the missing delimiters.  The two routines can also be used
  124. to remove delimiters from programs as well.  Be carefull though, there are
  125. actually three sets of these delimiters used by the 48, two of which are used
  126. for nesting routines within programs.  You could alter the intended results.
  127.  
  128.  
  129. Rick Grevelle
  130.  
  131.  
  132.